package com.cskaoyan.javase.oop2.encapsulate._0introduction;
/**
 * 对于boolean类型的成员变量来说
 * Getter方法的名字比较特殊，采用isXxx（Xxx是变量名）的形式。
 * 这时如果该boolean类型的成员变量本身就叫isXxx时，就会出现下面情况：
 *      成员变量名 isMale
 *      Getter方法也叫 isMale
 *      Setter方法叫 setMale
 * 这时通过Getter/Setter方法的名字,是无法得知该成员变量的名字的
 * 这是不好的,有些场景下,还会带来一些错误
 *
 * Getter/Setter方法在开发中,普遍不是让程序员去调用的,而是让框架自动去调用的
 * 框架在调用时,就会自动用Getter/Setter方法的名字去寻找对应的成员变量,如果找不到就会报错
 *
 *
 * @since 16:21
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo2 {
}
class Staff{
    private String gender;
    private boolean isMale;
    private boolean flag;

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public boolean isMale() {
        return isMale;
    }

    public void setMale(boolean male) {
        isMale = male;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }
}

class Teacher{
    private int id;
    private double salary;
    private String name;
    private String gender;

    public Teacher() {
    }

    public Teacher(int id, double salary, String name, String gender) {
        this.id = id;
        this.salary = salary;
        this.name = name;
        this.gender = gender;
    }

    public Teacher(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}